package course;

import java.util.HashMap;
import java.util.Map;

public class MyMap1 {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();

        //v put(K key, V value)  添加元素
        map.put("heima001","小智");
        map.put("heima002","小美");
        map.put("heima003","大胖");
        map.put("heima004","小黑");
        map.put("heima005","大师");

        String s = map.put("heima001","aaa");
        System.out.println(s);
        System.out.println(map);

        //V remove（Object key）  根据键删除值对元素
        String s1 = map.remove("heima001");
        System.out.println(s1);
        System.out.println(map);

        //void clear   移除所有键值对元素
        map.clear();
        System.out.println(map);

        //boolean containsKey(Object key)   判断是否包含指定元素
    }
}
